/**
  * class CR_TreeItem
  * Aids in the organization and storage of information of the items in the tree view
  * @param {Int} objId The id of the object that this ListItem points to
  * @param {Int} listId The index of the ListItem
  * @param {ItemType} type The item type that this ListItem refers to
  * @constructor
  */
var CR_TreeItem = function (objId, listId, type)
{
    /**
     * The id of the object that this ListItem points to
     */
    this.objId = objId;

    /**
     * The index number of this object.
     */
    this.listId = listId;

    /**
     * The type of object that this list item points to
     */
    this.type = type;

    return {
        /**
         * Sets the ListItem ID that this TreeItem belongs to. This function is useful
         * when a Character or BodyPart is deleted and the ListItem ids change
         * @param {Int} newListId
         */
        setListId : function(newListId)
        {
            listId = newListId;
        },

        /**
         * Gets the ListId of this TreeItem
         * @returns {Int} The list id of this ListItem
         */
        getListId : function(){
            return listId;
        },

        /**
         * Gets the object id that's paired with this TreeItem
         * @returns {Int} The object id of the object that this item points to
         */
        getObjectId : function(){
            return objId;
        },

        /**
         * Gets the object type of the object this TreeItem pertains to
         * @returns {TreeItems} The type of object this TreeItem pertains to
         */
        getObjectType : function(){
            return type;
        },

        /**
         * Returns whether or not a CR_TreeItem is a Character
         * @returns {Bool} True if this TreeItem is a Character, False if not.
         */
        isCharacter : function()
        {
            return type === TreeItems.CHARACTER;
        },

        /**
         * Returns whether or not a CR_TreeItem is a BodyPart
         * @returns {Bool} True if this TreeItem is a BodyPart, False if not.
         */
        isBodyPart : function()
        {
            return type === TreeItems.BODYPART;
        },

        toString : function()
        {
            return "TreeItem: ListId: " + listId + ", ObjectId: " + objId + ", Type: " + type;
        }
    }
}